package tvv.levelup.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tvv.levelup.dao.IPetDao;
import tvv.levelup.models.Pet;
/**
 * Created by VLAD on 03.09.2014.
 */
@Service
public class PetService implements IPetService{
    @Autowired
    private IPetDao petDao;

    @Override
    public Pet getPetById(int id) {
        return petDao.getPetById(id);
    }

    @Override
    public void savePet(Pet pet) {
        pet.setId(getActualPetId());
        petDao.savePet(pet);

    }

    private int getActualPetId() {
        return petDao.getActualPetId();
    }

    @Override
    public void deletePet(Pet pet) {
        petDao.deletePet(pet);

    }
}
